package com.isoft.demo.dao;

import com.isoft.demo.entity.Compensation;
import com.isoft.demo.entity.Orders;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CompensationDao {
    @Insert("insert into compensation (com_pay,com_oid,cause) " +
            "values (#{com_pay},#{com_oid},#{cause})")
    int addCom(Compensation com);

    @Select("select * from orders")
    List<Orders> searchComOid();

    @Select("select comid,com_oid,com_pay,cause,com_date,com_eid from compensation")
    List<Compensation> searchAllCom();

    @Select("SELECT * FROM compensation " +
            "WHERE com_oid=#{oid}")
    List<Compensation> searchComById(int oid);

    //暂时无法获取eid
    @Update("UPDATE compensation " +
            "SET com_date=#{date},com_eid=#{eid} " +
            "WHERE comid=#{comid}")
    int confirmCom(String date,String eid,int comid);

    @Select("SELECT eid FROM employee")
    int findComeid();

}
